{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Arbitrary discretization"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn.datasets import fetch_california_housing"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>MedInc</th>\n",
       "      <th>HouseAge</th>\n",
       "      <th>AveRooms</th>\n",
       "      <th>AveBedrms</th>\n",
       "      <th>Population</th>\n",
       "      <th>AveOccup</th>\n",
       "      <th>Latitude</th>\n",
       "      <th>Longitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>8.3252</td>\n",
       "      <td>41.0</td>\n",
       "      <td>6.984127</td>\n",
       "      <td>1.023810</td>\n",
       "      <td>322.0</td>\n",
       "      <td>2.555556</td>\n",
       "      <td>37.88</td>\n",
       "      <td>-122.23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>8.3014</td>\n",
       "      <td>21.0</td>\n",
       "      <td>6.238137</td>\n",
       "      <td>0.971880</td>\n",
       "      <td>2401.0</td>\n",
       "      <td>2.109842</td>\n",
       "      <td>37.86</td>\n",
       "      <td>-122.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>7.2574</td>\n",
       "      <td>52.0</td>\n",
       "      <td>8.288136</td>\n",
       "      <td>1.073446</td>\n",
       "      <td>496.0</td>\n",
       "      <td>2.802260</td>\n",
       "      <td>37.85</td>\n",
       "      <td>-122.24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>5.6431</td>\n",
       "      <td>52.0</td>\n",
       "      <td>5.817352</td>\n",
       "      <td>1.073059</td>\n",
       "      <td>558.0</td>\n",
       "      <td>2.547945</td>\n",
       "      <td>37.85</td>\n",
       "      <td>-122.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>3.8462</td>\n",
       "      <td>52.0</td>\n",
       "      <td>6.281853</td>\n",
       "      <td>1.081081</td>\n",
       "      <td>565.0</td>\n",
       "      <td>2.181467</td>\n",
       "      <td>37.85</td>\n",
       "      <td>-122.25</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   MedInc  HouseAge  AveRooms  AveBedrms  Population  AveOccup  Latitude  \\\n",
       "0  8.3252      41.0  6.984127   1.023810       322.0  2.555556     37.88   \n",
       "1  8.3014      21.0  6.238137   0.971880      2401.0  2.109842     37.86   \n",
       "2  7.2574      52.0  8.288136   1.073446       496.0  2.802260     37.85   \n",
       "3  5.6431      52.0  5.817352   1.073059       558.0  2.547945     37.85   \n",
       "4  3.8462      52.0  6.281853   1.081081       565.0  2.181467     37.85   \n",
       "\n",
       "   Longitude  \n",
       "0    -122.23  \n",
       "1    -122.22  \n",
       "2    -122.24  \n",
       "3    -122.25  \n",
       "4    -122.25  "
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# load the California House price data from Scikit-learn\n",
    "X, y = fetch_california_housing(return_X_y=True, as_frame=True)\n",
    "\n",
    "# display top 5 rows\n",
    "X.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# User defined discretization with pandas\n",
    "\n",
    "First we need to determine the interval edges or limits."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "plt.rcParams[\"figure.dpi\"] = 450"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEICAYAAACeSMncAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAdfklEQVR4nO3de5hV9X3v8fdHvIsKqGeOBSJoTFMvrQcnXmKOgdgqaqOePMaamoiGlp7GJCbaPmLUYLycYhJivDSmJKIYjYjECvESReOYpqmoGBXQGEbAKkGIgghKjJfv+WP9Rrfjnj1r1uy1Z7bzeT3PfvZav3X77DXDfFnrt/ZaigjMzMyK2KyvA5iZWfNyETEzs8JcRMzMrDAXETMzK8xFxMzMCnMRMTOzwlxEzPqYpGslXdSL5TdK2r2emczychEx60TSCkmb0h/n1emP/OC+zgUgqU3S31W2RcTgiFjWV5lsYHMRMavukxExGBgDtALn9nEes37JRcSshohYCdwJ7CPpGElLJL2Ujgj+rGO+dPRytqQnJK2TdI2krdO0UyT9snK9kkLSBztvT9JQSbdJ+n1az22SRqRpFwP/G7gyHSVd2XldknaUdF1a/hlJ50rarDKHpG+ndS+XdGQ5e84GChcRsxokjQSOAjYANwJfAXYB7gB+KmnLitlPAo4A9gA+RLGjl82Aa4DdgA8Am4ArASLiHOA/gC+mU1hfrLL8FcCOwO7Ax4GTgVMrph8IPAXsDHwTuFqSCuQ0A1xEzLpyq6SXgF8C9wNPALdHxPyIeB34NrAN8NGKZa6MiGcjYi1wMfCZnm40Il6MiJ9ExKsRsSGt5+N5lpU0CDgRODsiNkTECmAa8LmK2Z6JiB9ExJvATGBXoKWnOc06bN7XAc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VJA0GfgJ8JSJerpzW3/Zplaz9cr9GxJsRsR/ZHS4OAD7ct4mq65xT0j7A2WR5P0J2iuqsvkuYcRHpXr+5tUpErEzva4B/J/sHsDodmpLe16TZu8rdyM9Tr2wr03ApmSNidfoH+xbwA7L9WiTni2SnETbv1F6IpC3I/ijfEBG3pOZ+uU+rZe2v+7VDRLwE3AccXGP9b2dK03dMeRr276si5/h06jAi4jXgGorv0/r9/It0pAykF9m3+peRdZ51dJTt3Qc5tgO2rxj+FVlfxrd4d0frN9Pw0by7o+3BeKejbTlZJ9vQNDysThlH8e4O67pl472dgEfVMeeuFcNfJTvXDbA37+48XUbWcdrl7wRwM+/uoP1CwYwiO0/93U7t/W6f1sjaH/frLsCQNLwN8B/AX3e1fuA03t2xPrvoZ6hTzl0r9vl3gal9/vMv+g9xIL3Irnz4Ldm503P6KMPu6RfyMWBJRw6y87P3AkuBeyp+QUT2wK6ngUVAa8W6Pk/WEdgOnFqnfDeSnbJ4nez86sR6ZgNagcVpmStJd1uoU84fpRyPk917rfKP3zlpm09RcfVKV78T6ef0YMp/M7BVwZwfIztV9TjwaHod1U/3aVdZ++N+/XPg1ynTYuDrtdYPbJ3G29P03Yt+hjrl/Hnap4uB63nnCq4++/n7tidmZlaY+0TMzKwwFxEzMyvMRcTMzApzETEzs8JcRMzMrDAXETMzK8xFxMzMCvv/FV01Qe+7FmwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# let's plot a histogram to understand the\n",
    "# variable's value range.\n",
    "\n",
    "X[\"Population\"].hist(bins=30)\n",
    "plt.title(\"Population\")\n",
    "plt.ylabel(\"Number of observations\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "# bin boundaries - we will use with pandas cut()\n",
    "intervals = [0, 200, 500, 1000, 2000, np.Inf]\n",
    "\n",
    "# bin labels - we will use with pandas cut()\n",
    "labels = [\"0-200\", \"200-500\", \"500-1000\", \"1000-2000\", \">2000\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Population</th>\n",
       "      <th>Population_range</th>\n",
       "      <th>Population_limits</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>322.0</td>\n",
       "      <td>200-500</td>\n",
       "      <td>(200.0, 500.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2401.0</td>\n",
       "      <td>&gt;2000</td>\n",
       "      <td>(2000.0, inf]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>496.0</td>\n",
       "      <td>200-500</td>\n",
       "      <td>(200.0, 500.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>558.0</td>\n",
       "      <td>500-1000</td>\n",
       "      <td>(500.0, 1000.0]</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>565.0</td>\n",
       "      <td>500-1000</td>\n",
       "      <td>(500.0, 1000.0]</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Population Population_range Population_limits\n",
       "0       322.0          200-500    (200.0, 500.0]\n",
       "1      2401.0            >2000     (2000.0, inf]\n",
       "2       496.0          200-500    (200.0, 500.0]\n",
       "3       558.0         500-1000   (500.0, 1000.0]\n",
       "4       565.0         500-1000   (500.0, 1000.0]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# discretize variable: use labels for the intervals\n",
    "\n",
    "X_t = X.copy()\n",
    "\n",
    "# discretize variable: use interval limits\n",
    "\n",
    "X_t[\"Population_limits\"] = pd.cut(\n",
    "    X[\"Population\"],\n",
    "    bins=intervals,\n",
    "    labels=None,\n",
    "    include_lowest=True,\n",
    ")\n",
    "\n",
    "\n",
    "X_t[\"Population_range\"] = pd.cut(\n",
    "    X[\"Population\"],\n",
    "    bins=intervals,\n",
    "    labels=labels,\n",
    "    include_lowest=True,\n",
    ")\n",
    "\n",
    "\n",
    "# plot the original and 2 versions of the discretized variable\n",
    "\n",
    "X_t[[\"Population\", \"Population_range\", \"Population_limits\"]].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEXCAYAAABcRGizAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAeXUlEQVR4nO3debxf853H8ddbItZEgoyJJNwgajC2ppYyapkqMpbahgcaW+kMLWWWKC0tprSWUq1KawlVu9piX4d2hMSa0FRElNQSYknt4TN/nO91T677u+fcm3vu75f83s/H4/e453zP9vmeu3zuOd9zvl9FBGZmZp1ZrN4BmJlZ43OyMDOzQk4WZmZWyMnCzMwKOVmYmVkhJwszMyvkZGHWCyRdLOnkBdj+b5JW68mYzLrCycKakqSZkt5Pf4RfTX/Ml613XACS7pN0SL4sIpaNiBn1isnMycKa2U4RsSywETAKOL7O8Zg1LCcLa3oRMQu4FVhX0s6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oG8dgTIn1/wDslOq9LPAvAOmcPC9pTwBl1u+B+GwR4isLW5SdCFwo6UngPeb/g/okWRfpKwInRcRfAVK7wRSyWzqPtd9hRDwh6THgT2RDXv4ht3gccJukv0bE1rltHk1XIA+not9ExGPKhqtd0PpdLelN4B6y8VZqiohHJN1IVvdXybrDfjst3hc4T9LxZO0ZV5B1z24G4C7KrflIOhH4W0ScXu9YepukZSPib+l9kP8FDo2IR+sdlzU+X1mYNZdxktYma2cZ70RhZfnKwqzBSPoF2ZNLeWdHxEX1iMcMnCzMzKwEPw1lZmaFnCzMzKyQk4WZmRVysjAzs0L/D4+9ff6Gzl1SAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# let's check the number of observations per bin\n",
    "\n",
    "X_t[\"Population_range\"].value_counts().sort_index().plot.bar()\n",
    "plt.xticks(rotation=0)\n",
    "plt.ylabel(\"Number of observations\")\n",
    "plt.title(\"Population\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# User defined discretization with Feature-engine"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from feature_engine.discretisation import ArbitraryDiscretiser"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "intervals = {\n",
    "    \"Population\": [0, 200, 500, 1000, 2000, np.inf],\n",
    "    \"MedInc\": [0, 2, 4, 6, np.inf]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Population\n",
       "(-0.001, 200.0]     0.023934\n",
       "(1000.0, 2000.0]    0.426502\n",
       "(200.0, 500.0]      0.071996\n",
       "(2000.0, inf]       0.178295\n",
       "(500.0, 1000.0]     0.299273\n",
       "Name: proportion, dtype: float64"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "discretizer = ArbitraryDiscretiser(\n",
    "    binning_dict=intervals,\n",
    "    return_boundaries=True,\n",
    ")\n",
    "\n",
    "X_t = discretizer.fit_transform(X)\n",
    "\n",
    "X_t[\"Population\"].value_counts(normalize=True).sort_index()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>MedInc</th>\n",
       "      <th>HouseAge</th>\n",
       "      <th>AveRooms</th>\n",
       "      <th>AveBedrms</th>\n",
       "      <th>Population</th>\n",
       "      <th>AveOccup</th>\n",
       "      <th>Latitude</th>\n",
       "      <th>Longitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>(6.0, inf]</td>\n",
       "      <td>41.0</td>\n",
       "      <td>6.984127</td>\n",
       "      <td>1.023810</td>\n",
       "      <td>(200.0, 500.0]</td>\n",
       "      <td>2.555556</td>\n",
       "      <td>37.88</td>\n",
       "      <td>-122.23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>(6.0, inf]</td>\n",
       "      <td>21.0</td>\n",
       "      <td>6.238137</td>\n",
       "      <td>0.971880</td>\n",
       "      <td>(2000.0, inf]</td>\n",
       "      <td>2.109842</td>\n",
       "      <td>37.86</td>\n",
       "      <td>-122.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>(6.0, inf]</td>\n",
       "      <td>52.0</td>\n",
       "      <td>8.288136</td>\n",
       "      <td>1.073446</td>\n",
       "      <td>(200.0, 500.0]</td>\n",
       "      <td>2.802260</td>\n",
       "      <td>37.85</td>\n",
       "      <td>-122.24</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>(4.0, 6.0]</td>\n",
       "      <td>52.0</td>\n",
       "      <td>5.817352</td>\n",
       "      <td>1.073059</td>\n",
       "      <td>(500.0, 1000.0]</td>\n",
       "      <td>2.547945</td>\n",
       "      <td>37.85</td>\n",
       "      <td>-122.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>(2.0, 4.0]</td>\n",
       "      <td>52.0</td>\n",
       "      <td>6.281853</td>\n",
       "      <td>1.081081</td>\n",
       "      <td>(500.0, 1000.0]</td>\n",
       "      <td>2.181467</td>\n",
       "      <td>37.85</td>\n",
       "      <td>-122.25</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       MedInc  HouseAge  AveRooms  AveBedrms       Population  AveOccup  \\\n",
       "0  (6.0, inf]      41.0  6.984127   1.023810   (200.0, 500.0]  2.555556   \n",
       "1  (6.0, inf]      21.0  6.238137   0.971880    (2000.0, inf]  2.109842   \n",
       "2  (6.0, inf]      52.0  8.288136   1.073446   (200.0, 500.0]  2.802260   \n",
       "3  (4.0, 6.0]      52.0  5.817352   1.073059  (500.0, 1000.0]  2.547945   \n",
       "4  (2.0, 4.0]      52.0  6.281853   1.081081  (500.0, 1000.0]  2.181467   \n",
       "\n",
       "   Latitude  Longitude  \n",
       "0     37.88    -122.23  \n",
       "1     37.86    -122.22  \n",
       "2     37.85    -122.24  \n",
       "3     37.85    -122.25  \n",
       "4     37.85    -122.25  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X_t.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAFOCAYAAAB3xTGMAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAyZUlEQVR4nO3defzlc93/8cfToLGMfZIsja2FiqSiRaGsoQVpkaTUFSGuuiihoouylMQvZRdCiqwhXJWQLWsiS/ZGtsk+M8/fH+/3mTnzbWbOmTHne873nOf9dpvbnM92vu+zfV6fz/v1XmSbiIiImZmr2wWIiIjel2AREREtJVhERERLCRYREdFSgkVERLSUYBERES0lWEQMA0nHS9r/ZRz/b0krzMkyRcyKBIsYSJLulfRcPQk/Wk/mC3a7XACSLpf0ueZ1the0fXe3yhSRYBGDbDPbCwJrAGsCe3e5PBE9K8EiBp7tB4ELgDdK2lzSrZKerFf4b2jsV+9G9pJ0m6QnJB0naXTd9hlJf2h+XkmWtNLQvydpUUnnShpfn+dcScvUbQcA7wGOqHc9Rwx9LkkLSzqxHn+fpL0lzdVcDkkH1+e+R9LGnXnnYpAkWMTAk7QssAkwATgV2A0YC5wP/EbSvE27fxLYEFgReC2zdzcyF3Ac8BpgOeA54AgA298Afg/sXKuedp7O8T8CFgZWAN4LfBrYvmn7O4A7gCWA7wHHSNJslDNiigSLGGS/lvQk8AfgCuA24DzbF9t+CTgYmA94Z9MxR9i+3/bjwAHAx2f1j9r+l+1f2n7W9oT6PO9t51hJo4BtgL1sT7B9L3AIsG3TbvfZ/qntScAJwFLAkrNazohmc3e7ABFd9CHblzQWJB0F3NdYtj1Z0v3A0k3H3N/0+D7g1bP6RyXNDxwGbAQsWlePkTSqnuBnZglgnuZy1sfNZXyk8cD2s/WmoieS9zFy5c4iYqqHKFVDANSqm2WBB5v2Wbbp8XL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4yYmYwNFTGbJO0H/Nv2wd0uS0SnpRoqIiJayp1FRES0lDuLiIhoKcEiIiJaSrCIiIiWEiwiIqKlBIuIiGjp/wPU+E2APpgYewAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# let's check the number of observations per bin\n",
    "\n",
    "X_t[\"Population\"].value_counts().sort_index().plot.bar()\n",
    "plt.xticks(rotation=45)\n",
    "plt.ylabel(\"Number of observations\")\n",
    "plt.title(\"Population\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEWCAYAAACnlKo3AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/H5lhTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAdYklEQVR4nO3de7wVdb3/8dc78IIXBIHjTwF/mxQrtDIPeUnzV5r3jnhKDU8qGkW/sjItj5gVvzTPsZ+p6ak0UgrN4+WYKXkJES/9OiUKihdEfiBiwkFF8X4N/Zw/5rtwuVlr7dmzLnsv9/v5eOzHmvnOd2Y+M3uxP8x8v/MdRQRmZmZFvKenAzAzs/blJGJmZoU5iZiZWWFOImZmVpiTiJmZFeYkYmZmhTmJmPUikkLStj0dh1leTiJmBUlaJukNSUM7ld+bkkFHndv/taQf1hWkWZM5iZjV51HgiNKMpA8CG/VcOGat5SRiVp9LgaPL5icAl5RmJG0g6ceS/irpSUkXShpQtvwkSSsl/ZekL1TbiaSOdHUzIW3raUmnli3vJ+k7kh6R9KKkeZJGNvhYzdbhJGJWnzuBgZI+IKkfMB74TdnyM4HtgB2BbYHhwPcBJO0PfBvYBxgNfCrH/vYA3gfsDXxf0gdS+YlkV0QHAgOBLwCv1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pStASTsCSDpN0sGpXsXfA1mj8Bq6Ied220mt7+9aki6SVBqK/ExgH0mLgU+leYCtyf4n/g7pO/RtYLakB8i+o79M2323nU8oO6cNOPZuf0d7I4+dVYOknYATIuKoXhDLp8ka9c5v0vaXAWMjosdejtPI861sYM6/RkTDR3VO/fyvj4gdGr3tRmrw+TwLuDQi7q8/snW23UEbnE/o/d9RSS9FxCaN2l4evereWm8TEfdIuk1Sv57+X3tEVHworl6SBgB/Adajdm+lpmvk+Y6Iig/T1UvSx4Gf0/vfRNfo83lSo+Iq107nE3rvd1TSNsBvgScbtc3c+/aViJmZFeU2ETMzK8xJxMzMCnMSMWsASVH+vImk/pJWqcoAjzW2c3upp5SkZerhQTHNuuIkYtYYLwM7pI4KAPvQux7mNGsKJxGzxrkROChNH0E2DA0AkjaWNE3SXWmcpXGpfICkK5QNJf47YEDnjUrqSMt/qWzo75tLyUrStpJukXSfslcIbNP8wzR7m5OIWeNcQTYqwIZkw/nPKVt2KtmTyjsDnwTOkrQx8BXglYj4ADCFbKTdSkYDP4uI7cnGb/psKr8slX8Y+BjZkPlmLePnRMwaJCLuTw/OHUF2VVJuX7Ixu0qj6G5I9hT4nsD5ZetXe5jv0YiYn6bnAR2SNgWGR8Tv0vqvNepYzPJyEjFrrBlkAxx+gncO9y3gsxGxqLyytM5INtV0HoRvndteZj3Bt7PMGmsa8IOIeKBT+Uzg60pZQ9JHUvkfgX9KZTuQ3QbLJSJeBJZLOiStv4GkjeoL36x7nETMGii996HS+Gankw0tc38aVPP0VH4BsImkhcBpZLequuMo4BvpNtifgf9RLHKzYjzsiZmZFeYrETMzK8xJxMzMCnMSMTOzwpxEzMysMCcRMzMrzEnEzMwKcxIxM7PC/htWLjJIpBMBRwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# let's check the number of observations per bin\n",
    "\n",
    "X_t[\"MedInc\"].value_counts().sort_index().plot.bar()\n",
    "plt.xticks(rotation=0)\n",
    "plt.ylabel(\"Number of observations\")\n",
    "plt.title(\"MedInc\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "fsml",
   "language": "python",
   "name": "fsml"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "921.556px",
    "left": "0px",
    "right": "1852px",
    "top": "110.444px",
    "width": "281.333px"
   },
   "toc_section_display": "block",
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
